﻿namespace Dcms.DALFactory
{
    using Dcms.IDAL;
    using System;
    using System.Reflection;
    using System.Configuration;

    public class DALFactory
    {
        private static readonly string path = ConfigurationManager.AppSettings["DAL"];

        public static IDcms_AdminDAL CreateDcms_Admin()
        {
            string CacheKey = path + ".Dcms_AdminDAL";
            return (IDcms_AdminDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_CandidateRecordDAL CreateDcms_CandidateRecord()
        {
            string CacheKey = path + ".Dcms_CandidateRecordDAL";
            return (IDcms_CandidateRecordDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_CateDAL CreateDcms_Cate()
        {
            string CacheKey = path + ".Dcms_CateDAL";
            return (IDcms_CateDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_CommentDAL CreateDcms_Comment()
        {
            string CacheKey = path + ".Dcms_CommentDAL";
            return (IDcms_CommentDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_DownDAL CreateDcms_Down()
        {
            string CacheKey = path + ".Dcms_DownDAL";
            return (IDcms_DownDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_GuestBookDAL CreateDcms_GuestBook()
        {
            string CacheKey = path + ".Dcms_GuestBookDAL";
            return (IDcms_GuestBookDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_ImagesDAL CreateDcms_Images()
        {
            string CacheKey = path + ".Dcms_ImagesDAL";
            return (IDcms_ImagesDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_IntroDAL CreateDcms_Intro()
        {
            string CacheKey = path + ".Dcms_IntroDAL";
            return (IDcms_IntroDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_JobSeekerDAL CreateDcms_JobSeeker()
        {
            string CacheKey = path + ".Dcms_JobSeekerDAL";
            return (IDcms_JobSeekerDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_LinkDAL CreateDcms_Link()
        {
            string CacheKey = path + ".Dcms_LinkDAL";
            return (IDcms_LinkDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_ModelDAL CreateDcms_Model()
        {
            string CacheKey = path + ".Dcms_ModelDAL";
            return (IDcms_ModelDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_ModelFieldDAL CreateDcms_ModelField()
        {
            string CacheKey = path + ".Dcms_ModelFieldDAL";
            return (IDcms_ModelFieldDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_ModelFieldTempDAL CreateDcms_ModelFieldTemp()
        {
            string CacheKey = path + ".Dcms_ModelFieldTempDAL";
            return (IDcms_ModelFieldTempDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_NewsDAL CreateDcms_News()
        {
            string CacheKey = path + ".Dcms_NewsDAL";
            return (IDcms_NewsDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_PerAdminDAL CreateDcms_PerAdmin()
        {
            string CacheKey = path + ".Dcms_PerAdminDAL";
            return (IDcms_PerAdminDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_PermissionDAL CreateDcms_Permission()
        {
            string CacheKey = path + ".Dcms_PermissionDAL";
            return (IDcms_PermissionDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_PerRoleDAL CreateDcms_PerRole()
        {
            string CacheKey = path + ".Dcms_PerRoleDAL";
            return (IDcms_PerRoleDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_PositionDAL CreateDcms_Position()
        {
            string CacheKey = path + ".Dcms_PositionDAL";
            return (IDcms_PositionDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_ProductsDAL CreateDcms_Products()
        {
            string CacheKey = path + ".Dcms_ProductsDAL";
            return (IDcms_ProductsDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_RegexDAL CreateDcms_Regex()
        {
            string CacheKey = path + ".Dcms_RegexDAL";
            return (IDcms_RegexDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_RoleDAL CreateDcms_Role()
        {
            string CacheKey = path + ".Dcms_RoleDAL";
            return (IDcms_RoleDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_TempLateDAL CreateDcms_TempLate()
        {
            string CacheKey = path + ".Dcms_TempLateDAL";
            return (IDcms_TempLateDAL) CreateObject(path, CacheKey);
        }

        public static IDcms_VoteDAL CreateDcms_Vote()
        {
            string CacheKey = path + ".Dcms_VoteDAL";
            return (IDcms_VoteDAL) CreateObject(path, CacheKey);
        }

        public static IEntirelyDAL CreateEntirely()
        {
            string CacheKey = path + ".EntirelyDAL";
            return (IEntirelyDAL) CreateObject(path, CacheKey);
        }

        public static object CreateObject(string path, string CacheKey)
        {
            return Assembly.Load(path).CreateInstance(CacheKey);
        }
    }
}

